home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d7 / litecom6.arc / LCLIB.EXE / LCPROTO.H < prev    next >
Text File  |  1991-08-27  |  3KB  |  110 lines

  1. /*
  2. ** lcproto.h - Copyright (c) 1991 - Information Technology, Ltd.
  3. **               All Rights Reserved
  4. **
  5. ** Revisions
  6. **    00        05/30/91    Original Version
  7. */
  8.  
  9. #include <io.h>
  10.  
  11. #ifndef LITECOMM_H
  12. #include "litecomm.h"
  13. #endif
  14.  
  15. #ifndef LCPROTO_H
  16. #define LCPROTO_H
  17.  
  18. /*
  19. ** constants for  protocol definition
  20. */
  21. #define XMODEM        0x01
  22. #define XMODEM1K    0x02
  23. #define YMODEM        0x04
  24. #define WXMODEM        0x08
  25. #define ZMODEM        0x10
  26.  
  27. /*
  28. ** type definitions
  29. */
  30. typedef int (*ABORTFUNC)(void);
  31. typedef void(*STATFUNC)(int, int, void *);
  32.  
  33. /*
  34. ** the arguments passed to the users status function
  35. ** are:
  36. **    the status code
  37. **    the retry count
  38. **    a pointer to the PROTOCOL CONTROL BLOCK
  39. */
  40.  
  41. typedef struct
  42. {
  43.     unsigned        port;                /* port related to this block */
  44.     unsigned char    protocol;            /* protocol in use */
  45.     unsigned char    handshake[3];        /* handshake to use */
  46.     unsigned char    init;                /* true if init  required */
  47.     unsigned char    timeout;            /* timeout value in seconds */
  48.     unsigned char    sigtowatch;            /* signal to watch */
  49.     char            *buff;                /* pointer to i-o buffer */
  50.     int                rbsize;                /* size of received blocks */
  51.     int                errors;                /* total session errors */
  52.     int                handle;                /* handle of file being xferred */
  53.     unsigned        rec;                /* record counter */
  54.     int                crcmode;            /* crcmode for ?Modem */
  55.     unsigned        crc16;                /* crc-16 accumulator */
  56.     unsigned char    checksum;            /* checksum accumulator */
  57.     int                sentblks;            /* blocks sent (wxmodem) */
  58.     int                ackblks;            /* block acknowledged (wxmodem) */
  59.     int                maxpanes;            /* maximum panes, current window */
  60.     int                lastseq;            /* state variable (wxmodem) */
  61.     unsigned int    harderr;
  62. } PROTO;
  63.  
  64. #ifdef __TURBOC__
  65. typedef struct
  66. {
  67.     long    filelength;
  68.     struct ftime filetime;
  69.     char    filename[16];
  70.     unsigned char version;
  71.     char    programname[16];
  72. } TELINK;
  73. #else
  74. struct ftime
  75. {
  76.     int ft_tsec : 5;
  77.     int ft_hour : 6;
  78.     int ft_min    : 5;
  79.     int ft_day    : 5;
  80.     int ft_month : 4;
  81.     int ft_year : 7;
  82. };
  83.  
  84. typedef struct
  85. {
  86.     long    filelength;
  87.     struct ftime filetime;
  88.     char    filename[16];
  89.     unsigned char version;
  90.     char    programname[16];
  91. } TELINK;
  92. #endif
  93.  
  94. #define lcp_setsignal(x,y) (x->sigtowatch = y);
  95.  
  96. PROTO *lcp_alloc(unsigned port);
  97. void lcp_free(PROTO *p);
  98. int lcp_setproto(PROTO *p, unsigned char protocol, int usecrc);
  99. int pwait(unsigned, int, unsigned char);
  100. int dummyabort(void);
  101. void dummystatus(int, int, void *);
  102. void secstodate(unsigned long, unsigned, struct ftime *);
  103. unsigned long datetosecs(struct ftime *, unsigned);
  104. int lc_build_yzheader(int handle, char *filename, char *buff);
  105. void interpretblock(char *b, TELINK *t);
  106.  
  107. extern ABORTFUNC lcp_abort;
  108. extern STATFUNC lcp_status;
  109. #endif
  110.